import { defineStore } from 'pinia'

import { getFavorHistory, getFavorList } from '@/services'

const useFavorStore = defineStore("favor", {
  state: () => ({
    favorList: [],
    favorHistory: []
  }),
  actions: {
    async fetchFavorList() {
      const res = await getFavorList()
      this.favorList = res.data.data.items
    },
    async fetchFavorHostory() {
      const res = await getFavorHistory()
      this.favorHistory = res.data.data.items
    }
  }
})

export default useFavorStore